/**
 * 功能描述 
 */

define(function (require, exports, module) {
	var aw = require("ajaxwrapper")
	var Form = require("form");
	var store =require("store");
	var activeUser = store.get("user");
	var Dialog = require("dialog");
    var instance = {
        initComponent: function (params,widget) {
        	var form = new Form({
        	 parentNode:".J-form",
	  			 model:{
					 id:"form",
					 defaultButton : false,
					 layout : "2_1",
		       		 /*saveaction : function(){
		       			var data = form.getData();
		       			
		       			if(data.haveDinner=="true"){
		       				if(data.breakfast || data.lunch || data.supper ){
		       					data.status="Pended"
		       				}else{
		       					Dialog.alert({
		       						content:"落实单 未选择 早餐，午餐或晚餐！"
		       					});
		       					return;
		       				}
		       				
		       			}
		       			if(data.breakfast == "false"){
		       				data.breakfastConfirm = "false";
		       			}
		       			if(data.lunch == "false"){
		       				data.lunchConfirm = "false";
		       			}
		       			if(data.supper == "false"){
		       				data.supperConfirm = "false";
		       			}
		       			aw.saveOrUpdate("api/checkindinner/confirm",data,function(data){
		       				widget.show([".J-grid"]).hide([".J-form"]);
							widget.get("subnav").hide(["back"]).show(["search","checkStatus","servicePoint","dateRange"]);
							widget.get("grid").refresh();
		       			});
		       		 },
		       		 cancelaction : function(){       			 
			       			widget.show([".J-grid"]).hide([".J-form"]);
							widget.get("subnav").hide(["back"]).show(["search","checkStatus","servicePoint","dateRange"]);
							widget.get("grid").refresh();
		       		 },*/
					items:[{
						name:"groupReserve",
						label:"组团单位"
					},{
						name:"destination",
						label:"目的地"
					},{
						name:"checkInDate",
						label:"入住日期"
					},{
						name:"checkOutDate",
						label:"退住日期"
					},{
						name:"signUpNum",
						label:"报名人数"
					},{
			            name: "haveDinner",
			            type: "hidden",
			        },{
			            name: "breakfast",
			            type: "hidden",
			        },{
			            name: "breakfastConfirm",
			            type: "hidden",
			        },{
			            name: "lunch",
			            type: "hidden",
			        },{
			            name: "lunchConfirm",
			            type: "hidden",
			        },{
			            name: "supper",
			            type: "hidden",
			        },{
			            name: "supperConfirm",
			            type: "hidden",
			        },{
			            name: "description",
			            type: "textarea",
			            label: "备注",
			            "break":true
			        },{
			        	name:"version",
			        	type:"hidden"
			        },{
			        	name:"pkCheckInDinner",
			        	type:"hidden"
			        },{
			        	name:"checkInImplement",
			        	type:"hidden"
			        },{
			        	name:"operator",
			        	type:"hidden",
			        	defaultValue: activeUser.pkUser
			        },{
			        	name:"operateDate",
			        	type:"hidden",
			        	defaultValue:new Date().getTime()
			        }]
	  			 }
           });
        widget.set("form",form);
       }
    };
    module.exports = instance;
});
